#ifndef _RINGBUFFER_H_
#define _RINGBUFFER_H_

#include "../custom_types.h"

#ifdef __cplusplus
extern "C"
{
#endif

	typedef struct
	{
		rbsize head;
		rbsize tail;

		rbsize size;
		rbdata *buffer;
	} ringbuffer;

	void rb_init(ringbuffer *rb, rbdata *buffer, rbsize size);
	void rb_push(ringbuffer *rb, rbdata d);
	void rb_pop(ringbuffer *rb, rbdata *d);
	rbsize rb_size(ringbuffer *rb);

	int rb_test();

#ifdef __cplusplus
}
#endif

#endif // _RINGBUFFER_H_